<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:pe="http://primefaces.org/ui/extensions"
                template="/templates/mainLayout.xhtml">

    <ui:define name="title">Đăng ký</ui:define>
    <ui:define name="content">
        <h:form id="contentForm">
            <p:panel header="Đăng ký" style="width: 450px; margin-top: 10px; margin-left: auto; margin-right: auto;">
                <p:messages id="msgs"/>
                <h:panelGrid styleClass="panelGrid" columnClasses="ui-state-default labelCol, ui-widget-content" 
                             columns="2" cellpadding="5" width="100%">  
                    <h:outputLabel for="username" style="display: inline; float: right; padding-right: 5px;" value="Tên đăng nhập *" />  
                    <p:inputText value="#{registerBean.username}" id="username" required="true" label="Tên đăng nhập" size="25" maxlength="50"
                                 requiredMessage="Yêu cầu nhập tên đăng nhập">
                        <pe:keyFilter regEx="/[a-z0-9_]/i"/>
                    </p:inputText>
                    
                    <h:outputLabel for="email" style="display: inline; float: right; padding-right: 5px;" value="Email *" />  
                    <p:inputText value="#{registerBean.email}" id="email" required="true" label="Email" size="25" maxlength="50"
                                 requiredMessage="Yêu cầu nhập email">
                        <pe:keyFilter regEx="/[a-z0-9_\.\-@]/i"/>
                    </p:inputText>
                    
                    <h:outputLabel for="password" style="display: inline; float: right; padding-right: 5px;" value="Mật khẩu *" />
                    <p:password id="password" value="#{registerBean.password}" required="true" label="Mật khẩu" size="25" maxlength="50"
                                requiredMessage="Yêu cầu nhập mật khẩu"/>
                    
                    <h:outputLabel for="retypepassword" style="display: inline; float: right; padding-right: 5px;" value="Nhập lại mật khẩu *" />
                    <p:password id="retypepassword" value="#{registerBean.reTypePassword}" required="true" label="Nhập lại mật khẩu" size="25" maxlength="50"
                                requiredMessage="Yêu cầu nhập lại mật khẩu"/>
                    
                    <h:outputText value=""/>
                    <p:commandButton value="Đăng ký" ajax="false" action="#{registerBean.registerAction()}"/>
                </h:panelGrid>
            </p:panel>
        </h:form>
    </ui:define>
</ui:composition>